<!-- build time:Wed Jun 21 2023 22:33:35 GMT+0800 (GMT+08:00) --><!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=2"><meta name="theme-color" content="#FFF"><meta name="baidu-site-verification" content="code-C0oocRvMWv"><link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png"><link rel="icon" type="image/ico" sizes="32x32" href="/images/favicon.ico"><link rel="mask-icon" href="/images/logo.svg" color=""><link rel="manifest" href="/images/manifest.json"><meta name="msapplication-config" content="/images/browserconfig.xml"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="baidu-site-verification" content="https://jiang-hs.gitee.io"><link rel="alternate" type="application/rss+xml" title="航 順" href="https://jiang-hs.gitee.io/rss.xml"><link rel="alternate" type="application/atom+xml" title="航 順" href="https://jiang-hs.gitee.io/atom.xml"><link rel="alternate" type="application/json" title="航 順" href="https://jiang-hs.gitee.io/feed.json"><link rel="stylesheet" href="//fonts.googleapis.com/css?family=Mulish:300,300italic,400,400italic,700,700italic%7CFredericka%20the%20Great:300,300italic,400,400italic,700,700italic%7CNoto%20Serif%20JP:300,300italic,400,400italic,700,700italic%7CNoto%20Serif%20SC:300,300italic,400,400italic,700,700italic%7CInconsolata:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext"><link rel="stylesheet" href="/css/app.css?v=0.0.0"><meta name="keywords" content="人工智能,学习笔记"><link rel="canonical" href="https://jiang-hs.gitee.io/posts/9eceac59/"><meta name="description" content="本文是基于文章 “STAN: Spatio-Temporal Attention Network for Next Location Recommendation” 的一篇学习笔记 ​		基于地点的移动端服务商，譬如 Yelp、Uber，要从大量的用户签到和轨迹信息中学习用户的行程习惯，对用户下一个访问地点进行预测，并以此为用户的下一步行程需求进行规划和推荐。然而，现有模型对时空信息的利用存在局限"><meta property="og:type" content="article"><meta property="og:title" content="基于时空注意力的地点推荐模型学习笔记"><meta property="og:url" content="https://jiang-hs.gitee.io/posts/9eceac59/index.html"><meta property="og:site_name" content="航 順"><meta property="og:description" content="本文是基于文章 “STAN: Spatio-Temporal Attention Network for Next Location Recommendation” 的一篇学习笔记 ​		基于地点的移动端服务商，譬如 Yelp、Uber，要从大量的用户签到和轨迹信息中学习用户的行程习惯，对用户下一个访问地点进行预测，并以此为用户的下一步行程需求进行规划和推荐。然而，现有模型对时空信息的利用存在局限"><meta property="og:locale" content="zh_CN"><meta property="og:image" content="https://shun309.oss-cn-hangzhou.aliyuncs.com/photos/006GbOqBly1gokmiwblioj30pi0i3tky.jpg"><meta property="og:image" content="https://p6-tt.byteimg.com/origin/pgc-image/SQrHlvO3g5JLI?from=pc"><meta property="og:image" content="https://p6-tt.byteimg.com/origin/pgc-image/SQrHlvuB1Mx4r7?from=pc"><meta property="og:image" content="https://wx1.sinaimg.cn/large/006GbOqBly1goknks9ps2j307r0130si.jpg"><meta property="og:image" content="https://p6-tt.byteimg.com/origin/pgc-image/SQrHmQY8hyJ7Ry?from=pc"><meta property="og:image" content="https://p6-tt.byteimg.com/origin/pgc-image/SQrHmRCEqKlLOt?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHmRgGwmcxUD?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHmSC8hwt80W?from=pc"><meta property="og:image" content="https://p3-tt.byteimg.com/origin/pgc-image/SQrHmSsCYgDRbG?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHmpWEqFMGkV?from=pc"><meta property="og:image" content="https://p6-tt.byteimg.com/origin/pgc-image/SQrHmqBHpC2r4z?from=pc"><meta property="og:image" content="https://p3-tt.byteimg.com/origin/pgc-image/SQrHmqfHVRY9A1?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHmr9IJJvtfV?from=pc"><meta property="og:image" content="https://p3-tt.byteimg.com/origin/pgc-image/SQrHmrg6xjhbhV?from=pc"><meta property="og:image" content="https://p3-tt.byteimg.com/origin/pgc-image/SQrHnEkIzwqMjj?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHnFPBy2e2tj?from=pc"><meta property="og:image" content="https://p3-tt.byteimg.com/origin/pgc-image/SQrHnFyDO0B7wJ?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHnHPEGA9gZt?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHnHx9G1AKOa?from=pc"><meta property="og:image" content="https://p6-tt.byteimg.com/origin/pgc-image/SQrHnfbBZg8pnW?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHnsh8bHKJkh?from=pc"><meta property="og:image" content="https://p1-tt.byteimg.com/origin/pgc-image/SQrHntFCceIfwt?from=pc"><meta property="og:image" content="https://p6-tt.byteimg.com/origin/pgc-image/SQrHntmCVcUzv0?from=pc"><meta property="article:published_time" content="2021-03-15T07:26:44.000Z"><meta property="article:modified_time" content="2023-01-12T04:19:43.143Z"><meta property="article:author" content="hang shun"><meta property="article:tag" content="人工智能"><meta property="article:tag" content="学习笔记"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://shun309.oss-cn-hangzhou.aliyuncs.com/photos/006GbOqBly1gokmiwblioj30pi0i3tky.jpg"><title>基于时空注意力的地点推荐模型学习笔记 | hang shun = 航 順 = 天官赐福，百无禁忌</title><meta name="generator" content="Hexo 5.4.2"></head><body itemscope itemtype="http://schema.org/WebPage"><div id="loading"><div class="cat"><div class="body"></div><div class="head"><div class="face"></div></div><div class="foot"><div class="tummy-end"></div><div class="bottom"></div><div class="legs left"></div><div class="legs right"></div></div><div class="paw"><div class="hands left"></div><div class="hands right"></div></div></div></div><div id="container"><header id="header" itemscope itemtype="http://schema.org/WPHeader"><div class="inner"><div id="brand"><div class="pjax"><h1 itemprop="name headline">基于时空注意力的地点推荐模型学习笔记</h1><div class="meta"><span class="item" title="创建时间：2021-03-15 15:26:44"><span class="icon"><i class="ic i-calendar"></i> </span><span class="text">发表于</span> <time itemprop="dateCreated datePublished" datetime="2021-03-15T15:26:44+08:00">2021-03-15</time> </span><span class="item" title="本文字数"><span class="icon"><i class="ic i-pen"></i> </span><span class="text">本文字数</span> <span>5.4k</span> <span class="text">字</span> </span><span class="item" title="阅读时长"><span class="icon"><i class="ic i-clock"></i> </span><span class="text">阅读时长</span> <span>5 分钟</span></span></div></div></div><nav id="nav"><div class="inner"><div class="toggle"><div class="lines" aria-label="切换导航栏"><span class="line"></span> <span class="line"></span> <span class="line"></span></div></div><ul class="menu"><li class="item title"><a href="/" rel="start">hang shun</a></li></ul><ul class="right"><li class="item theme"><i class="ic i-sun"></i></li><li class="item search"><i class="ic i-search"></i></li></ul></div></nav></div><div id="imgs" class="pjax"><ul><li class="item" data-background-image="https://pic1.imgdb.cn/item/60d7f97b5132923bf8a9b545.jpg"></li><li class="item" data-background-image="https://pic1.imgdb.cn/item/64427dbb0d2dde5777b203f9.png"></li><li class="item" data-background-image="https://pic1.imgdb.cn/item/60d7f99b5132923bf8aa654e.jpg"></li><li class="item" data-background-image="https://pic1.imgdb.cn/item/60d7f9855132923bf8a9f1ba.jpg"></li><li class="item" data-background-image="https://pic1.imgdb.cn/item/60d7f96c5132923bf8a968e0.jpg"></li><li class="item" data-background-image="https://pic1.imgdb.cn/item/64427a850d2dde5777acb130.jpg"></li></ul></div></header><div id="waves"><svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"><defs><path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z"/></defs><g class="parallax"><use xlink:href="#gentle-wave" x="48" y="0"/><use xlink:href="#gentle-wave" x="48" y="3"/><use xlink:href="#gentle-wave" x="48" y="5"/><use xlink:href="#gentle-wave" x="48" y="7"/></g></svg></div><main><div class="inner"><div id="main" class="pjax"><div class="article wrap"><div class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList"><i class="ic i-home"></i> <span><a href="/">首页</a></span></div><article itemscope itemtype="http://schema.org/Article" class="post block" lang="zh-CN"><link itemprop="mainEntityOfPage" href="https://jiang-hs.gitee.io/posts/9eceac59/"><span hidden itemprop="author" itemscope itemtype="http://schema.org/Person"><meta itemprop="image" content="/images/avatar.jpg"><meta itemprop="name" content="hang shun"><meta itemprop="description" content="天官赐福，百无禁忌, 世中逢尔，雨中逢花"></span><span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization"><meta itemprop="name" content="航 順"></span><div class="body md" itemprop="articleBody"><p>本文是基于文章 “STAN: Spatio-Temporal Attention Network for Next Location Recommendation” 的一篇学习笔记</p><p>​ 基于地点的移动端服务商，譬如 Yelp、Uber，要从大量的用户签到和轨迹信息中学习用户的行程习惯，对用户下一个访问地点进行预测，并以此为用户的下一步行程需求进行规划和推荐。然而，现有模型对时空信息的利用存在局限性，譬如只利用前后一步的时间和空间差，人为划分空间区域或者只聚合距离较近的地点，并对访问地点的频率不加考虑。本文旨在提出一种基于注意力机制的神经网络架构，考虑用户访问轨迹中每个访问点相较于整个过往访问轨迹的时空关系，以此对不相邻非连续但功能相近的访问点进行关联，打破以往仅仅关联连续、相邻访问点的限制。</p><h1 id="1-问题背景和主要贡献"><a class="anchor" href="#1-问题背景和主要贡献">#</a> 1 问题背景和主要贡献</h1><p>​ 地点序列推荐任务过去主要依赖于<strong>马尔可夫模型</strong>和<strong>循环神经网络</strong>。最近两年，随着神经网络的发展，注意力机制和图模型逐渐被用在地点序列推荐任务中，其预测精度和召回率相较于过去的模型获得显著的提高。然而，当下的模型仍有以下三个局限：</p><p>1）空间上不相邻且时间上非连续的访问点可能是功能相关的，然而过去的绝大多数模型只考虑空间上处于一个区域且时间上前后邻近的访问点的时空关联；</p><p>2）空间上划分区域的方法使得模型对空间距离不敏感，不可避免地丢失了空间差信息和不相邻点的关联信息；</p><p>3）过去模型没有充分考虑用户访问频率。</p><p>​ 我们不妨截取真实数据中一位用户的轨迹片段进行可视化，以说明为何不相邻非连续的访问却有可能是时空和功能上高度相关的。在上图中，我们用 0-6 这 7 个阿拉伯数字分别表示 7 个地点，用一个时间轴将该用户访问的顺序和时间表示出来；其中，虚心坐标 0、1、2 分别代表家、公司、商场（根据 GPS 定位查找得出），而实心坐标代表餐馆。可以看到，这位用户总在周末逛商场、在工作日去公司，并且有就近就餐的习惯。显然，在这里，用户总在餐点去餐馆打卡，而不同的餐馆虽然相互地理位置和时间上不相邻，却反映类似的功能，因此在时空上呈现明显的关联性。这种关联性可以有效地帮助我们推断用户在某个具体的时空点如何规划下一步访问计划。</p><p><img data-src="https://shun309.oss-cn-hangzhou.aliyuncs.com/photos/006GbOqBly1gokmiwblioj30pi0i3tky.jpg" alt="基于时空注意力的地点推荐模型"></p><p>​ 原作者提出一种新的地点序列推荐的模型，STAN，即时空注意力网络：</p><p>​ STAN 是<strong>第一个将用户访问轨迹中每个访问点相较于过往访问轨迹的直接时空差纳入地点序列推荐的模型</strong>，让 STAN 具备从全局轨迹层面上聚合时空不相邻访问点的能力。</p><p>​ 离散化嵌入空间与时间差值时，STAN 建立单位时间空间向量，使用插值方法替换空间网格划分区域的方法，对时空关联差值大小更加敏感。</p><p>​ STAN 采用一种<strong>双层注意力架构：前一层聚合轨迹内相关访问点以更新地点表示；后一层根据当前时空点和轨迹内访问点的时空关联召回候选集中的地点</strong>。相同的地点可能在轨迹内重复出现，因此重复召回考虑了用户的访问频率。</p><p>​ STAN 使用了<strong>平衡的样本采集器，缓解了正负样本不均衡问题</strong>。</p><p>​ STAN 与其他 State-Of-The-Art 模型在四个真实数据集上的对比和消融实验表明，STAN 可以有效提升召回率 9-17% 左右，并且提出的每一个架构改进均有提升效果。</p><h1 id="2-问题定义"><a class="anchor" href="#2-问题定义">#</a> 2 问题定义</h1><h2 id="21-历史轨迹"><a class="anchor" href="#21-历史轨迹">#</a> 2.1 历史轨迹</h2><p>​ 在我们考虑的问题中，每一个用户 的轨迹</p><p><img data-src="https://p6-tt.byteimg.com/origin/pgc-image/SQrHlvO3g5JLI?from=pc" alt="STAN: 基于时空注意力的地点推荐模型"></p><p>​ 每个地点对应一个单独的经纬度坐标，因此我们可以直接通过函数求得每两个地点 和 之间的地理距离 。由于每个用户的到访记录序列均不相同，且长短不一，数据预处理阶段我们截取一个最大长度为 的序列 ；如果 则截取最近的 个访问点，如果 则向原序列右边补零（不参与计算）。</p><p>​ 用户 ui 的运行轨迹是临时有序的登记处。用户 ui 轨迹中的每个登记处 rk 都是一个元组 (ui,lk,tk)，其中 lk 是位置，tk 是时间戳。每个用户可能有一个可变长度的轨迹 tra (ui) = {r1, r2，…, rm}。我们<strong>将每个轨迹转换为一个固定长度的序列</strong> seq (ui) = {r1, r2，…，rn}， n 为我们考虑的最大长度。如果 n&lt;mi，我们只考虑最近的 n 个登记处；如果 n&gt;mi，则向右填充 0，直到序列长度为 n，并在计算过程中屏蔽填充项。</p><h2 id="22-轨迹时空关系矩阵"><a class="anchor" href="#22-轨迹时空关系矩阵">#</a> 2.2 轨迹时空关系矩阵</h2><p>​ 我们可以将两点之间的时间差和地理距离作为直接时空关联信息，其中序列中第<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi></mrow><annotation encoding="application/x-tex">i</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.65952em;vertical-align:0"></span><span class="mord mathnormal">i</span></span></span></span> 个点和第<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>j</mi></mrow><annotation encoding="application/x-tex">j</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.85396em;vertical-align:-.19444em"></span><span class="mord mathnormal" style="margin-right:.05724em">j</span></span></span></span> 个点之间的时间差和空间距离分别表示为</p><p><img data-src="https://p6-tt.byteimg.com/origin/pgc-image/SQrHlvuB1Mx4r7?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p>​ <strong>半正矢公式（haversine 公式）可以通过经纬度和弧度的转变，然后得到地球上两点的距离。</strong></p><p><img data-src="https://wx1.sinaimg.cn/large/006GbOqBly1goknks9ps2j307r0130si.jpg" alt=""></p><p>计算轨迹内每个访问点之间的时空关联，分别得到时间矩阵和空间矩阵 。</p><p><img data-src="https://p6-tt.byteimg.com/origin/pgc-image/SQrHmQY8hyJ7Ry?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h2 id="23-候选时空关系矩阵"><a class="anchor" href="#23-候选时空关系矩阵">#</a> 2.3 候选时空关系矩阵</h2><p>​ 除了轨迹内部的时空关联，我们还可以<strong>将轨迹中每个访问点与候选集中可能的下一点间的时空关联信息用于下一点预测</strong>，其中轨迹中第<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi></mrow><annotation encoding="application/x-tex">i</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.65952em;vertical-align:0"></span><span class="mord mathnormal">i</span></span></span></span> 个点和候选集中第<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>j</mi></mrow><annotation encoding="application/x-tex">j</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.85396em;vertical-align:-.19444em"></span><span class="mord mathnormal" style="margin-right:.05724em">j</span></span></span></span> 个点之间的时间差和空间距离分别表示为：</p><p><img data-src="https://p6-tt.byteimg.com/origin/pgc-image/SQrHmRCEqKlLOt?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p>​ 计算轨迹内每个访问点之间的时空关联，可以分别得到候选时间矩阵和候选空间矩阵 。</p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHmRgGwmcxUD?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h2 id="24-下一地点预测"><a class="anchor" href="#24-下一地点预测">#</a> 2.4 下一地点预测</h2><p>​ 给定用户轨迹 (<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>r</mi><mn>1</mn></msub></mrow><annotation encoding="application/x-tex">r_1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.58056em;vertical-align:-.15em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.02778em">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.30110799999999993em"><span style="top:-2.5500000000000003em;margin-left:-.02778em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span></span></span></span>,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>r</mi><mn>2</mn></msub></mrow><annotation encoding="application/x-tex">r_2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.58056em;vertical-align:-.15em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.02778em">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.30110799999999993em"><span style="top:-2.5500000000000003em;margin-left:-.02778em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span></span></span></span>,…,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>r</mi><mi>m</mi></msub></mrow><annotation encoding="application/x-tex">r_m</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.58056em;vertical-align:-.15em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.02778em">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.151392em"><span style="top:-2.5500000000000003em;margin-left:-.02778em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">m</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span></span></span></span>) ，候选地点集合 (<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>l</mi><mn>1</mn></msub></mrow><annotation encoding="application/x-tex">l_1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.84444em;vertical-align:-.15em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.01968em">l</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.30110799999999993em"><span style="top:-2.5500000000000003em;margin-left:-.01968em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span></span></span></span>,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>l</mi><mn>2</mn></msub></mrow><annotation encoding="application/x-tex">l_2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.84444em;vertical-align:-.15em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.01968em">l</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.30110799999999993em"><span style="top:-2.5500000000000003em;margin-left:-.01968em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span></span></span></span>,…,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>l</mi><mi>L</mi></msub></mrow><annotation encoding="application/x-tex">l_L</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.84444em;vertical-align:-.15em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.01968em">l</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.32833099999999993em"><span style="top:-2.5500000000000003em;margin-left:-.01968em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">L</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span></span></span></span>) ，轨迹时空关联矩阵<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mtext>∆</mtext><mrow><mi>t</mi><mo separator="true">,</mo><mi>s</mi></mrow></msup></mrow><annotation encoding="application/x-tex">∆^{t,s}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.7935559999999999em;vertical-align:0"></span><span class="mord"><span class="mord">∆</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.7935559999999999em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">t</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight">s</span></span></span></span></span></span></span></span></span></span></span></span> 和 候选时空关联矩阵<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>N</mi><mrow><mi>t</mi><mo separator="true">,</mo><mi>s</mi></mrow></msup></mrow><annotation encoding="application/x-tex">N^{t,s}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.7935559999999999em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.10903em">N</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.7935559999999999em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">t</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight">s</span></span></span></span></span></span></span></span></span></span></span></span> ，我们的目标是精准预测下一个访问点的地点序号 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>l</mi><mo>∈</mo><msub><mi>r</mi><mrow><mi>m</mi><mo>+</mo><mn>1</mn></mrow></msub></mrow><annotation encoding="application/x-tex">l∈r_{m+1}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.73354em;vertical-align:-.0391em"></span><span class="mord mathnormal" style="margin-right:.01968em">l</span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.638891em;vertical-align:-.208331em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.02778em">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.301108em"><span style="top:-2.5500000000000003em;margin-left:-.02778em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">m</span><span class="mbin mtight">+</span><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.208331em"><span></span></span></span></span></span></span></span></span></span>。</p><h1 id="3-模型与方法"><a class="anchor" href="#3-模型与方法">#</a> 3 模型与方法</h1><p>模型总共由四个模块组成：嵌入模块，自注意力聚合层，注意力匹配层，平衡采样器。</p><p>1)<strong> 多模态嵌入模块</strong>，学习用户、位置、时间和时空效应的密集表示；</p><p>2)<strong> 自我注意聚合层</strong>，将用户轨迹中的重要相关位置聚集起来，更新每次签到的表示；</p><p>3)<strong> 注意匹配层</strong>，根据加权签到表示计算 softmax 概率，计算每个位置候选到下一个位置的概率；</p><p>4)<strong> 平衡采样器</strong>，使用一个正样本和几个负样本来计算交叉熵损失。</p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHmSC8hwt80W?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h2 id="31-嵌入模块"><a class="anchor" href="#31-嵌入模块">#</a> 3.1 嵌入模块</h2><p>​ 多模态嵌入模块（Multimodal Embedding）由两部分组成，即轨迹嵌入层和时空嵌入层。</p><h3 id="311-用户轨迹嵌入层"><a class="anchor" href="#311-用户轨迹嵌入层">#</a> 3.1.1 用户轨迹嵌入层</h3><p>​ 我们用三个独立的嵌入层分别将用户、地点、时间转换为潜表示：<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>e</mi><mi>u</mi></msup><mo>∈</mo><msup><mi>R</mi><mi>d</mi></msup></mrow><annotation encoding="application/x-tex">e^u∈R^d</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.703492em;vertical-align:-.0391em"></span><span class="mord"><span class="mord mathnormal">e</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.664392em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">u</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.849108em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.849108em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">d</span></span></span></span></span></span></span></span></span></span></span>,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>e</mi><mi>l</mi></msup><mo>∈</mo><msup><mi>R</mi><mi>d</mi></msup></mrow><annotation encoding="application/x-tex">e^l∈R^d</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.888208em;vertical-align:-.0391em"></span><span class="mord"><span class="mord mathnormal">e</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.849108em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:.01968em">l</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.849108em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.849108em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">d</span></span></span></span></span></span></span></span></span></span></span>,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>e</mi><mi>t</mi></msup><mo>∈</mo><msup><mi>R</mi><mi>d</mi></msup></mrow><annotation encoding="application/x-tex">e^t∈R^d</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.832656em;vertical-align:-.0391em"></span><span class="mord"><span class="mord mathnormal">e</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.7935559999999999em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">t</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.849108em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.849108em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">d</span></span></span></span></span></span></span></span></span></span></span> 。将嵌入模块整合到其他模块中，将标量转换为密集向量，以减少计算量，提高表达效果。这里，连续时间戳除以 7×24 = 168 小时，这代表一周中的确切小时数，它将原始时间映射到 168 维中。这种时间离散化可以指示以一天或一周为单位的确切时间，反映出周期性。因此，嵌入件的输入尺寸 $𝑒_𝑢 , 𝑒_𝑙 $ 和 $ 𝑒_𝑡 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext>分别为</mtext><mi>U</mi><mo separator="true">,</mo><mi>L</mi><mo separator="true">,</mo><mi>a</mi><mi>n</mi><mi>d</mi><mn>168</mn><mtext>。每次签到的用户轨迹嵌入层的输出</mtext><mi>r</mi><mtext>为：</mtext></mrow><annotation encoding="application/x-tex">分别为 U, L, and 168。 每次签到的用户轨迹嵌入层的输出r为：</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.8888799999999999em;vertical-align:-.19444em"></span><span class="mord cjk_fallback">分</span><span class="mord cjk_fallback">别</span><span class="mord cjk_fallback">为</span><span class="mord mathnormal" style="margin-right:.10903em">U</span><span class="mpunct">,</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mord mathnormal">L</span><span class="mpunct">,</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mord mathnormal">a</span><span class="mord mathnormal">n</span><span class="mord mathnormal">d</span><span class="mord">1</span><span class="mord">6</span><span class="mord">8</span><span class="mord cjk_fallback">。</span><span class="mord cjk_fallback">每</span><span class="mord cjk_fallback">次</span><span class="mord cjk_fallback">签</span><span class="mord cjk_fallback">到</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">用</span><span class="mord cjk_fallback">户</span><span class="mord cjk_fallback">轨</span><span class="mord cjk_fallback">迹</span><span class="mord cjk_fallback">嵌</span><span class="mord cjk_fallback">入</span><span class="mord cjk_fallback">层</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">输</span><span class="mord cjk_fallback">出</span><span class="mord mathnormal" style="margin-right:.02778em">r</span><span class="mord cjk_fallback">为</span><span class="mord cjk_fallback">：</span></span></span></span>𝑒^𝑟 = 𝑒^𝑢 + 𝑒 ^𝑙 + 𝑒^𝑡 ∈ R^d$ 。对于每个用户的嵌入序列<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mi>e</mi><mi>q</mi><mo stretchy="false">(</mo><msub><mi>𝑢</mi><mi>𝑖</mi></msub><mo stretchy="false">)</mo><mo>=</mo><mrow><msub><mi>𝑟</mi><mn>1</mn></msub><mtext>，</mtext><msub><mi>𝑟</mi><mn>2</mn></msub><mtext>，</mtext><mo>…</mo><mo separator="true">,</mo><msub><mi>𝑟</mi><mi>𝑛</mi></msub></mrow></mrow><annotation encoding="application/x-tex">seq(𝑢_𝑖)={𝑟_1，𝑟_2，…,𝑟_𝑛}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-.25em"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">e</span><span class="mord mathnormal" style="margin-right:.03588em">q</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">u</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.31166399999999994em"><span style="top:-2.5500000000000003em;margin-left:0;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span><span class="mclose">)</span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">=</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.8777699999999999em;vertical-align:-.19444em"></span><span class="mord"><span class="mord"><span class="mord mathnormal" style="margin-right:.02778em">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.30110799999999993em"><span style="top:-2.5500000000000003em;margin-left:-.02778em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span><span class="mord cjk_fallback">，</span><span class="mord"><span class="mord mathnormal" style="margin-right:.02778em">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.30110799999999993em"><span style="top:-2.5500000000000003em;margin-left:-.02778em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span><span class="mord cjk_fallback">，</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="minner">…</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.02778em">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.151392em"><span style="top:-2.5500000000000003em;margin-left:-.02778em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">n</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span></span></span></span></span>，我们表示为：</p><p><img data-src="https://p3-tt.byteimg.com/origin/pgc-image/SQrHmSsCYgDRbG?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h3 id="312-时空嵌入层"><a class="anchor" href="#312-时空嵌入层">#</a> 3.1.2 时空嵌入层</h3><p>​ 我们提出时间和空间差的单位嵌入层 ，将每个小时和每一百米作为基本单元，映射到一个维度为 的欧氏空间。对于每两个访问点之间的时间差和空间差的嵌入表示，我们可以计算<strong>其真实差值乘以单位嵌入表示</strong>，而不是对每一个的时间差和空间差单独作为嵌入维度。这样做的好处是，在时空嵌入的过程中，我们仍然可以保持对差值的敏感度，大大减少计算量（输入维度仅为 2）的计算方式可以表达为：</p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHmpWEqFMGkV?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p>经过嵌入得到的</p><p><img data-src="https://p6-tt.byteimg.com/origin/pgc-image/SQrHmqBHpC2r4z?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p>再经过求和，可以得到最终的轨迹嵌入和候选嵌入 。</p><p><img data-src="https://p3-tt.byteimg.com/origin/pgc-image/SQrHmqfHVRY9A1?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h2 id="32-自注意力聚合层"><a class="anchor" href="#32-自注意力聚合层">#</a> 3.2 自注意力聚合层</h2><p>​ 该模块的作用是聚合轨迹内相关的访问点，并且以此更新每个访问点的表示。这里使用的自注意力机制可以捕捉长期记忆，并且每一个访问点对当前点的影响和时空关联均会被考虑。给定用户嵌入的非填充长度为 m ' 的轨迹矩阵<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>E</mi><mo stretchy="false">(</mo><mi>u</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">E(u)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-.25em"></span><span class="mord mathnormal" style="margin-right:.05764em">E</span><span class="mopen">(</span><span class="mord mathnormal">u</span><span class="mclose">)</span></span></span></span> 和时空关系矩阵<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>E</mi><mo stretchy="false">(</mo><mi mathvariant="normal">Δ</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">E(Δ)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-.25em"></span><span class="mord mathnormal" style="margin-right:.05764em">E</span><span class="mopen">(</span><span class="mord">Δ</span><span class="mclose">)</span></span></span></span> ，该层首先构建一个 mask 矩阵<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>M</mi><mo>∈</mo><msup><mi>R</mi><mrow><mi>n</mi><mo>×</mo><mi>n</mi></mrow></msup></mrow><annotation encoding="application/x-tex">M∈R^{n×n}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.72243em;vertical-align:-.0391em"></span><span class="mord mathnormal" style="margin-right:.10903em">M</span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.771331em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.771331em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">n</span><span class="mbin mtight">×</span><span class="mord mathnormal mtight">n</span></span></span></span></span></span></span></span></span></span></span></span> ，其左上角元素 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>R</mi><mrow><msup><mi>m</mi><mo mathvariant="normal" lspace="0em" rspace="0em">′</mo></msup><mo>×</mo><msup><mi>m</mi><mo mathvariant="normal" lspace="0em" rspace="0em">′</mo></msup></mrow></msup></mrow><annotation encoding="application/x-tex">R^{m&#x27;×m&#x27;}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.94248em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.94248em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight">m</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.8278285714285715em"><span style="top:-2.931em;margin-right:.07142857142857144em"><span class="pstrut" style="height:2.5em"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mbin mtight">×</span><span class="mord mtight"><span class="mord mathnormal mtight">m</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.8278285714285715em"><span style="top:-2.931em;margin-right:.07142857142857144em"><span class="pstrut" style="height:2.5em"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> 为 1，其余元素为 0；并同时构建参数矩阵<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>W</mi><mi>Q</mi></msub><mo separator="true">,</mo><msub><mi>W</mi><mi>K</mi></msub><mo separator="true">,</mo><msub><mi>W</mi><mi>V</mi></msub><mo>∈</mo><msup><mi>R</mi><mrow><mi>d</mi><mo>×</mo><mi>d</mi></mrow></msup></mrow><annotation encoding="application/x-tex">W_Q, W_K, W_V ∈ R^{d×d}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:.969438em;vertical-align:-.286108em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.13889em">W</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.328331em"><span style="top:-2.5500000000000003em;margin-left:-.13889em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">Q</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.286108em"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.13889em">W</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.32833099999999993em"><span style="top:-2.5500000000000003em;margin-left:-.13889em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:.07153em">K</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.13889em">W</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.32833099999999993em"><span style="top:-2.5500000000000003em;margin-left:-.13889em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:.22222em">V</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.15em"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.8491079999999999em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.8491079999999999em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">d</span><span class="mbin mtight">×</span><span class="mord mathnormal mtight">d</span></span></span></span></span></span></span></span></span></span></span></span>，计算出该层输出 ：</p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHmr9IJJvtfV?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p><img data-src="https://p3-tt.byteimg.com/origin/pgc-image/SQrHmrg6xjhbhV?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h2 id="33-注意力匹配层"><a class="anchor" href="#33-注意力匹配层">#</a> 3.3 注意力匹配层</h2><p>​ 该模块的作用是从候选地点集合中召回最有可能下一步访问的地点。给定用户轨迹更新后的表示<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>S</mi><mo stretchy="false">(</mo><mi>u</mi><mo stretchy="false">)</mo><mo>∈</mo><msup><mi>R</mi><mrow><mi>n</mi><mo>×</mo><mi>d</mi></mrow></msup></mrow><annotation encoding="application/x-tex">S(u)∈R^{n×d}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-.25em"></span><span class="mord mathnormal" style="margin-right:.05764em">S</span><span class="mopen">(</span><span class="mord mathnormal">u</span><span class="mclose">)</span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.8491079999999999em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.8491079999999999em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">n</span><span class="mbin mtight">×</span><span class="mord mathnormal mtight">d</span></span></span></span></span></span></span></span></span></span></span></span> ，地点集合的嵌入表示<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>E</mi><mo stretchy="false">(</mo><mi>l</mi><mo stretchy="false">)</mo><mo>=</mo><mrow><msubsup><mi>e</mi><mn>1</mn><mi>l</mi></msubsup><mo separator="true">,</mo><msubsup><mi>e</mi><mn>2</mn><mi>l</mi></msubsup><mo separator="true">,</mo><mo>…</mo><mo separator="true">,</mo><msubsup><mi>e</mi><mi>L</mi><mi>l</mi></msubsup></mrow><mo>∈</mo><msup><mi>R</mi><mrow><mi>L</mi><mo>×</mo><mi>d</mi></mrow></msup></mrow><annotation encoding="application/x-tex">E(l)={e_1^l,e_2^l,…,e_L^l}∈R^{L×d}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-.25em"></span><span class="mord mathnormal" style="margin-right:.05764em">E</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:.01968em">l</span><span class="mclose">)</span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">=</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:1.124439em;vertical-align:-.275331em"></span><span class="mord"><span class="mord"><span class="mord mathnormal">e</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.849108em"><span style="top:-2.4518920000000004em;margin-left:0;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:.01968em">l</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.24810799999999997em"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mord"><span class="mord mathnormal">e</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.849108em"><span style="top:-2.4518920000000004em;margin-left:0;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:.01968em">l</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.24810799999999997em"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="minner">…</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:.16666666666666666em"></span><span class="mord"><span class="mord mathnormal">e</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:.849108em"><span style="top:-2.424669em;margin-left:0;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">L</span></span></span><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:.01968em">l</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:.275331em"><span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.8491079999999999em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.8491079999999999em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">L</span><span class="mbin mtight">×</span><span class="mord mathnormal mtight">d</span></span></span></span></span></span></span></span></span></span></span></span>，以及候选时空关系矩阵的嵌入<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>E</mi><mo stretchy="false">(</mo><mi>N</mi><mo stretchy="false">)</mo><mo>∈</mo><msup><mi>R</mi><mrow><mi>L</mi><mo>×</mo><mi>n</mi></mrow></msup></mrow><annotation encoding="application/x-tex">E(N)∈R^{L×n}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-.25em"></span><span class="mord mathnormal" style="margin-right:.05764em">E</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:.10903em">N</span><span class="mclose">)</span><span class="mspace" style="margin-right:.2777777777777778em"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:.2777777777777778em"></span></span><span class="base"><span class="strut" style="height:.8413309999999999em;vertical-align:0"></span><span class="mord"><span class="mord mathnormal" style="margin-right:.00773em">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:.8413309999999999em"><span style="top:-3.063em;margin-right:.05em"><span class="pstrut" style="height:2.7em"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">L</span><span class="mbin mtight">×</span><span class="mord mathnormal mtight">n</span></span></span></span></span></span></span></span></span></span></span></span>，这一层计算每个位置候选成为下一个位置的概率为：</p><p><img data-src="https://p3-tt.byteimg.com/origin/pgc-image/SQrHnEkIzwqMjj?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHnFPBy2e2tj?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h2 id="34-平衡采样器"><a class="anchor" href="#34-平衡采样器">#</a> 3.4 平衡采样器</h2><p>​ 由于<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi><mo stretchy="false">(</mo><mi>u</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">A(u)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-.25em"></span><span class="mord mathnormal">A</span><span class="mopen">(</span><span class="mord mathnormal">u</span><span class="mclose">)</span></span></span></span> 中正样本和负样本的比例不平衡，正负样本的不均衡可能导致全样本的损失函数失效。这里我们不妨在每次计算损失函数时只采样部分负样本，在参数更新的过程中，更倾向于” 奖励得到正确的结果 “而不是” 避免得到错误的结果 “。考虑超参数 表示负样本数，可以将损失函数改写为：</p><p><img data-src="https://p3-tt.byteimg.com/origin/pgc-image/SQrHnFyDO0B7wJ?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h1 id="4实验"><a class="anchor" href="#4实验">#</a> 4 实验</h1><p><strong>1、对比实验</strong></p><p>这里我们考虑四个真实数据集：Gowalla, SIN, TKY 和 NYC，如图。</p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHnHPEGA9gZt?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p>划分数据集时，我们主要考虑因果关系避免穿越现象：即只使用过往的访问点来预测当前访问点的下一步，而不能使用未来的数据。对于一个长度为 的用户访问序列，可以得到 个训练数据，以最开始的 个数据为输入序列，以第 个访问地点为标签。而验证数据集则是以最开始的 个数据为输入序列，以第 个访问点为标签。最后，以最后一个访问点为标签，构建测试数据集。</p><p>我们选取了近三年尤其是最近一年的最先进的模型作为基线：</p><p>1）STRNN，一种基于 RNN 的考虑前后一步时空差的推荐系统；</p><p>2）DeepMove，一种结合 RNN 和 Attention 的考虑周期性的系统；</p><p>3）STGN，一种加入时间和距离差的门结构的新型 RNN 推荐系统；</p><p>4）ARNN，一种考虑语义和用图聚合近邻空间信息的 LSTM 推荐系统；</p><p>5）LSTPM，一种将长期记忆和短期记忆相结合的序列推荐系统；</p><p>6）TiSASRec，一种考虑各访问点之间时间差的自注意力推荐系统；</p><p>7）GeoSAN，一种使用人为网格进行空间离散化的自注意力系统。</p><p>我们采用召回率作为评估推荐效果的指标：Recall@5 和 Recall@10。Recall@k 是计算概率最大的前 k 个样本中出现真实标签的比例，值越高代表模型的效果越好。从图中可以看到，STAN 的效果比过去最好的模型的召回率高 9-17% 不等，有非常明显的提升。这里的召回率使用的是不同种子十次训练完毕后的召回率平均值。</p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHnHx9G1AKOa?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p><strong>2、消融实验</strong></p><p>我们考虑消融以下模块以判断其对推荐效果的提升程度：</p><p>1）SIM，即使用轨迹内访问点之间空间距离差求和构建轨迹矩阵和候选矩阵；</p><p>2）EWSI，即此前的工作 TiSASRec 提出的矩阵元素单独计算的空间矩阵构建；</p><p>3）TIM，即使用轨迹内访问点之间时间差求和构建轨迹矩阵和候选矩阵；</p><p>4）EWTI，即此前的工作 TiSASRec 提出的矩阵元素单独计算的时间矩阵构建；</p><p>5）BS，即使用平衡采样器改进损失函数。</p><p>实验表明，采样器的提升大约在 5-12%，用空间和时间差作为信息提供了 4-8% 左右的提升；使用直接的矩阵计算和矩阵元素单独计算并没有太大差别，但更加省时。如果，将所有 1-5 的模块都排除，-ALL 的效果仍然比基于 RNN 的模型要好，因为它考虑了访问频率。</p><p><img data-src="https://p6-tt.byteimg.com/origin/pgc-image/SQrHnfbBZg8pnW?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p><strong>3、稳定性实验</strong></p><p>我们考虑修改嵌入维度和采样器中负样本数量这两个超参数对推荐效果的影响，以判断 STAN 在不同超参数下的稳定性。如图，Gowalla 作为一个大数据集，比较容易受到过低嵌入维度的影响，但对负样本数量增加不敏感；其它数据集对维度和样本量都不敏感，除了 SIN 数据集对于负样本量的增加不是非常稳定。总体来说，STAN 对于超参数的变化并不是非常敏感，多数时候超参数的一步变化只对模型效果有 0.1-0.5% 的影响。</p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHnsh8bHKJkh?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p><img data-src="https://p1-tt.byteimg.com/origin/pgc-image/SQrHntFCceIfwt?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><p><strong>4、解释性实验</strong></p><p>我们考虑可视化自注意力聚合层中的相关性矩阵，即 query 和 key 相乘经过 softmax 得到的矩阵；以第一部分问题背景的案例图为例，STAN 不仅会将地理距离较近的访问点聚合起来作为相关，而且将不相邻非连续但功能相近的访问点聚合起来。STAN 具备自动从时空关系中挖掘相关联访问点的学习能力。</p><p><img data-src="https://p6-tt.byteimg.com/origin/pgc-image/SQrHntmCVcUzv0?from=pc" alt="WWW 2021 | STAN: 基于时空注意力的地点推荐模型"></p><h1 id="5总结"><a class="anchor" href="#5总结">#</a> 5 总结</h1><p>本文提出了一种时空注意力网络 STAN，能够有效学习不相邻非连续访问点之间的时空关联，用单位时空离散化替代空间网格，通过双层结构设计考虑用户访问频率。本文在四个真实数据集上用对比、消融、稳定性、解释性实验分析了该方法的实际效果，发现 STAN 能够有效提高目前已知最好模型的推荐效果和召回率达 9-17%。</p><p>原文链接：<br><span class="exturl" data-url="aHR0cHM6Ly9hcnhpdi5vcmcvYWJzLzIxMDIuMDQwOTU=">https://arxiv.org/abs/2102.04095</span></p><p>Github 链接：<br><span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL3lpbmd0YW9sdW8vU3BhdGlhbC1UZW1wb3JhbC1BdHRlbnRpb24tTmV0d29yay1mb3ItUE9JLVJlY29tbWVuZGF0aW9u">https://github.com/yingtaoluo/Spatial-Temporal-Attention-Network-for-POI-Recommendation</span></p><div class="tags"><a href="/tags/%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD/" rel="tag"><i class="ic i-tag"></i> 人工智能</a> <a href="/tags/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" rel="tag"><i class="ic i-tag"></i> 学习笔记</a></div></div><footer><div class="meta"><span class="item"><span class="icon"><i class="ic i-calendar-check"></i> </span><span class="text">更新于</span> <time title="修改时间：2023-01-12 12:19:43" itemprop="dateModified" datetime="2023-01-12T12:19:43+08:00">2023-01-12</time> </span><span id="posts/9eceac59/" class="item leancloud_visitors" data-flag-title="基于时空注意力的地点推荐模型学习笔记" title="阅读次数"><span class="icon"><i class="ic i-eye"></i> </span><span class="text">阅读次数</span> <span class="leancloud-visitors-count"></span> <span class="text">次</span></span></div><div class="reward"><button><i class="ic i-heartbeat"></i> 赞赏</button><p>请我喝[茶]~(￣▽￣)~*</p><div id="qr"><div><img data-src="/images/wechatpay.png" alt="hang shun 微信支付"><p>微信支付</p></div><div><img data-src="/images/alipay.png" alt="hang shun 支付宝"><p>支付宝</p></div><div><img data-src="/images/paypal.png" alt="hang shun 贝宝"><p>贝宝</p></div></div></div><div id="copyright"><ul><li class="author"><strong>本文作者： </strong>hang shun <i class="ic i-at"><em>@</em></i>航 順</li><li class="link"><strong>本文链接：</strong> <a href="https://jiang-hs.gitee.io/posts/9eceac59/" title="基于时空注意力的地点推荐模型学习笔记">https://jiang-hs.gitee.io/posts/9eceac59/</a></li><li class="license"><strong>版权声明： </strong>本站所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzQuMC9kZWVkLnpo"><i class="ic i-creative-commons"><em>(CC)</em></i>BY-NC-SA</span> 许可协议。转载请注明出处！</li></ul></div></footer></article></div><div class="post-nav"><div class="item left"><a href="/posts/321bfdac/" itemprop="url" rel="prev" data-background-image="https:&#x2F;&#x2F;pic1.imgdb.cn&#x2F;item&#x2F;64427dbb0d2dde5777b20462.png" title="融合商品潜在互补性发现学习笔记"><span class="type">上一篇</span> <span class="category"><i class="ic i-flag"></i></span><h3>融合商品潜在互补性发现学习笔记</h3></a></div><div class="item right"><a href="/posts/435711c9/" itemprop="url" rel="next" data-background-image="https:&#x2F;&#x2F;pic1.imgdb.cn&#x2F;item&#x2F;64427c380d2dde5777afaa9c.jpg" title="解决github无法访问"><span class="type">下一篇</span> <span class="category"><i class="ic i-flag"></i> Debug</span><h3>解决github无法访问</h3></a></div></div><div class="wrap" id="comments"></div></div><div id="sidebar"><div class="inner"><div class="panels"><div class="inner"><div class="contents panel pjax" data-title="文章目录"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#1-%E9%97%AE%E9%A2%98%E8%83%8C%E6%99%AF%E5%92%8C%E4%B8%BB%E8%A6%81%E8%B4%A1%E7%8C%AE"><span class="toc-number">1.</span> <span class="toc-text">1 问题背景和主要贡献</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#2-%E9%97%AE%E9%A2%98%E5%AE%9A%E4%B9%89"><span class="toc-number">2.</span> <span class="toc-text">2 问题定义</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#21-%E5%8E%86%E5%8F%B2%E8%BD%A8%E8%BF%B9"><span class="toc-number">2.1.</span> <span class="toc-text">2.1 历史轨迹</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#22-%E8%BD%A8%E8%BF%B9%E6%97%B6%E7%A9%BA%E5%85%B3%E7%B3%BB%E7%9F%A9%E9%98%B5"><span class="toc-number">2.2.</span> <span class="toc-text">2.2 轨迹时空关系矩阵</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#23-%E5%80%99%E9%80%89%E6%97%B6%E7%A9%BA%E5%85%B3%E7%B3%BB%E7%9F%A9%E9%98%B5"><span class="toc-number">2.3.</span> <span class="toc-text">2.3 候选时空关系矩阵</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#24-%E4%B8%8B%E4%B8%80%E5%9C%B0%E7%82%B9%E9%A2%84%E6%B5%8B"><span class="toc-number">2.4.</span> <span class="toc-text">2.4 下一地点预测</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#3-%E6%A8%A1%E5%9E%8B%E4%B8%8E%E6%96%B9%E6%B3%95"><span class="toc-number">3.</span> <span class="toc-text">3 模型与方法</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#31-%E5%B5%8C%E5%85%A5%E6%A8%A1%E5%9D%97"><span class="toc-number">3.1.</span> <span class="toc-text">3.1 嵌入模块</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#311-%E7%94%A8%E6%88%B7%E8%BD%A8%E8%BF%B9%E5%B5%8C%E5%85%A5%E5%B1%82"><span class="toc-number">3.1.1.</span> <span class="toc-text">3.1.1 用户轨迹嵌入层</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#312-%E6%97%B6%E7%A9%BA%E5%B5%8C%E5%85%A5%E5%B1%82"><span class="toc-number">3.1.2.</span> <span class="toc-text">3.1.2 时空嵌入层</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#32-%E8%87%AA%E6%B3%A8%E6%84%8F%E5%8A%9B%E8%81%9A%E5%90%88%E5%B1%82"><span class="toc-number">3.2.</span> <span class="toc-text">3.2 自注意力聚合层</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#33-%E6%B3%A8%E6%84%8F%E5%8A%9B%E5%8C%B9%E9%85%8D%E5%B1%82"><span class="toc-number">3.3.</span> <span class="toc-text">3.3 注意力匹配层</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#34-%E5%B9%B3%E8%A1%A1%E9%87%87%E6%A0%B7%E5%99%A8"><span class="toc-number">3.4.</span> <span class="toc-text">3.4 平衡采样器</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#4%E5%AE%9E%E9%AA%8C"><span class="toc-number">4.</span> <span class="toc-text">4 实验</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#5%E6%80%BB%E7%BB%93"><span class="toc-number">5.</span> <span class="toc-text">5 总结</span></a></li></ol></div><div class="related panel pjax" data-title="系列文章"></div><div class="overview panel" data-title="站点概览"><div class="author" itemprop="author" itemscope itemtype="http://schema.org/Person"><img class="image" itemprop="image" alt="hang shun" data-src="/images/avatar.jpg"><p class="name" itemprop="name">hang shun</p><div class="description" itemprop="description">世中逢尔，雨中逢花</div></div><nav class="state"><div class="item posts"><a href="/archives/"><span class="count">45</span> <span class="name">文章</span></a></div><div class="item categories"><a href="/categories/"><span class="count">10</span> <span class="name">分类</span></a></div><div class="item tags"><a href="/tags/"><span class="count">25</span> <span class="name">标签</span></a></div></nav><div class="social"><span class="exturl item github" data-url="aHR0cHM6Ly9naXRodWIuY29tL0pJQU5HLUhT" title="https:&#x2F;&#x2F;github.com&#x2F;JIANG-HS"><i class="ic i-github"></i></span> <span class="exturl item zhihu" data-url="aHR0cHM6Ly93d3cuemhpaHUuY29tL3Blb3BsZS9odWktc2h1bi14aW4tbGl1" title="https:&#x2F;&#x2F;www.zhihu.com&#x2F;people&#x2F;hui-shun-xin-liu"><i class="ic i-zhihu"></i></span> <span class="exturl item music" data-url="aHR0cHM6Ly9tdXNpYy4xNjMuY29tLyMvdXNlci9ob21lP2lkPTE4MzkwMTczMzI=" title="https:&#x2F;&#x2F;music.163.com&#x2F;#&#x2F;user&#x2F;home?id&#x3D;1839017332"><i class="ic i-cloud-music"></i></span> <span class="exturl item bilibili" data-url="aHR0cHM6Ly9zcGFjZS5iaWxpYmlsaS5jb20vMzIxMTYyNDg1" title="https:&#x2F;&#x2F;space.bilibili.com&#x2F;321162485"><i class="ic i-bilibili"></i></span></div><ul class="menu"><li class="item"><a href="/" rel="section"><i class="ic i-home"></i>首页</a></li><li class="item"><a href="/about/" rel="section"><i class="ic i-user"></i>关于</a></li><li class="item dropdown"><a href="javascript:void(0);"><i class="ic i-feather"></i>文章</a><ul class="submenu"><li class="item"><a href="/archives/" rel="section"><i class="ic i-list-alt"></i>归档</a></li><li class="item"><a href="/categories/" rel="section"><i class="ic i-th"></i>分类</a></li><li class="item"><a href="/tags/" rel="section"><i class="ic i-tags"></i>标签</a></li></ul></li><li class="item"><a href="/friends/" rel="section"><i class="ic i-heart"></i>友達</a></li><li class="item"><a href="/movie/" rel="section"><i class="ic i-play"></i>movie</a></li><li class="item"><a href="/music/" rel="section"><i class="ic i-music"></i>music</a></li></ul></div></div></div><ul id="quick"><li class="prev pjax"><a href="/posts/321bfdac/" rel="prev" title="上一篇"><i class="ic i-chevron-left"></i></a></li><li class="up"><i class="ic i-arrow-up"></i></li><li class="down"><i class="ic i-arrow-down"></i></li><li class="next pjax"><a href="/posts/435711c9/" rel="next" title="下一篇"><i class="ic i-chevron-right"></i></a></li><li class="percent"></li></ul></div></div><div class="dimmer"></div></div></main><footer id="footer"><div class="inner"><div class="widgets"><div class="rpost pjax"><h2>随机文章</h2><ul><li class="item"><div class="breadcrumb"></div><span><a href="/posts/748f0bbe/" title="强化学习">强化学习</a></span></li><li class="item"><div class="breadcrumb"><a href="/categories/Debug/" title="分类于 Debug">Debug</a></div><span><a href="/posts/b23109f/" title="HDF5报错和解决">HDF5报错和解决</a></span></li><li class="item"><div class="breadcrumb"><a href="/categories/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E5%9F%BA%E7%A1%80/" title="分类于 机器学习基础">机器学习基础</a></div><span><a href="/posts/a10feb4a/" title="协同过滤算法">协同过滤算法</a></span></li><li class="item"><div class="breadcrumb"><a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/" title="分类于 论文精读">论文精读</a> <i class="ic i-angle-right"></i> <a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/" title="分类于 新闻推荐">新闻推荐</a> <i class="ic i-angle-right"></i> <a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/%E9%9A%90%E7%A7%81%E4%BF%9D%E6%8A%A4%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/" title="分类于 隐私保护新闻推荐">隐私保护新闻推荐</a> <i class="ic i-angle-right"></i> <a href="/categories/%E8%81%94%E9%82%A6%E5%AD%A6%E4%B9%A0/" title="分类于 联邦学习">联邦学习</a></div><span><a href="/posts/ef078385/" title="FedNewsRec：隐私保护新闻推荐模型学习">FedNewsRec：隐私保护新闻推荐模型学习</a></span></li><li class="item"><div class="breadcrumb"></div><span><a href="/posts/6a16b017/" title="51单片机基础-4">51单片机基础-4</a></span></li><li class="item"><div class="breadcrumb"><a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/" title="分类于 论文精读">论文精读</a> <i class="ic i-angle-right"></i> <a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/" title="分类于 新闻推荐">新闻推荐</a> <i class="ic i-angle-right"></i> <a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/%E9%9A%90%E7%A7%81%E4%BF%9D%E6%8A%A4%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/" title="分类于 隐私保护新闻推荐">隐私保护新闻推荐</a> <i class="ic i-angle-right"></i> <a href="/categories/%E8%81%94%E9%82%A6%E5%AD%A6%E4%B9%A0/" title="分类于 联邦学习">联邦学习</a></div><span><a href="/posts/d414c6e0/" title="Efficient-FedRec：高效的新闻推荐隐私保护框架">Efficient-FedRec：高效的新闻推荐隐私保护框架</a></span></li><li class="item"><div class="breadcrumb"></div><span><a href="/posts/7c185f0e/" title="基于深度强化学习的长期推荐系统">基于深度强化学习的长期推荐系统</a></span></li><li class="item"><div class="breadcrumb"></div><span><a href="/posts/83751522/" title="51单片机基础-2">51单片机基础-2</a></span></li><li class="item"><div class="breadcrumb"></div><span><a href="/posts/f47225b4/" title="51单片机基础-3">51单片机基础-3</a></span></li><li class="item"><div class="breadcrumb"><a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/" title="分类于 论文精读">论文精读</a> <i class="ic i-angle-right"></i> <a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/" title="分类于 新闻推荐">新闻推荐</a> <i class="ic i-angle-right"></i> <a href="/categories/%E6%B3%A8%E6%84%8F%E5%8A%9B%E6%9C%BA%E5%88%B6/" title="分类于 注意力机制">注意力机制</a> <i class="ic i-angle-right"></i> <a href="/categories/%E8%AE%BA%E6%96%87%E7%B2%BE%E8%AF%BB/%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/%E9%9A%90%E7%A7%81%E4%BF%9D%E6%8A%A4%E6%96%B0%E9%97%BB%E6%8E%A8%E8%8D%90/" title="分类于 隐私保护新闻推荐">隐私保护新闻推荐</a></div><span><a href="/posts/e3b95b70/" title="Fastformer：Additive Attention Can Be All You Need">Fastformer：Additive Attention Can Be All You Need</a></span></li></ul></div><div><h2>最新评论</h2><ul class="leancloud-recent-comment"></ul></div></div><div class="status"><div class="copyright">&copy; 2020 – <span itemprop="copyrightYear">2023</span> <span class="with-love"><i class="ic i-sakura rotate"></i> </span><span class="author" itemprop="copyrightHolder">hang shun @ hang shun</span></div><div class="count"><span class="post-meta-item-icon"><i class="ic i-chart-area"></i> </span><span title="站点总字数">267k 字</span> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"><i class="ic i-coffee"></i> </span><span title="站点阅读时长">4:02</span></div><div class="powered-by">基于 <span class="exturl" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> & Theme.<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2FtZWhpbWUvaGV4by10aGVtZS1zaG9rYQ==">Shoka</span></div></div></div></footer></div><script data-config type="text/javascript">var LOCAL={path:"posts/9eceac59/",favicon:{show:"(´Д｀)被发现了！",hide:"（●´3｀●）我藏好了~"},search:{placeholder:"文章搜索",empty:"关于 「 ${query} 」，什么也没搜到",stats:"${time} ms 内找到 ${hits} 条结果"},valine:!0,copy_tex:!0,katex:!0,fancybox:!0,copyright:'复制成功，转载请遵守 <i class="ic i-creative-commons"></i>BY-NC-SA 协议。',ignores:[function(e){return e.includes("#")},function(e){return new RegExp(LOCAL.path+"$").test(e)}]}</script><script src="https://cdn.polyfill.io/v2/polyfill.js"></script><script src="//cdn.jsdelivr.net/combine/npm/pace-js@1.0.2/pace.min.js,npm/pjax@0.2.8/pjax.min.js,npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js,npm/animejs@3.2.0/lib/anime.min.js,npm/algoliasearch@4/dist/algoliasearch-lite.umd.js,npm/instantsearch.js@4/dist/instantsearch.production.min.js,npm/lozad@1/dist/lozad.min.js,npm/quicklink@2/dist/quicklink.umd.js"></script><script src="/js/app.js?v=0.0.0"></script></body></html><!-- rebuild by hrmmi -->